arm64: fix fls()
authorJan Beulich <jbeulich@suse.com>
Fri, 23 Jan 2015 14:02:39 +0000 (15:02 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 23 Jan 2015 14:02:39 +0000 (15:02 +0100)
commite9c1747a25763c66de4a06923946c59a9f043069
treebfd55007f90aefff16c09e03e0a67b7178d3e6b9
parentefb0d962cd3a10f1595fc49c95574874f0a02ea0
arm64: fix fls()

It using CLZ on a 64-bit register while specifying the input operand as
only 32 bits wide is wrong: An operand intentionally shrunk down to 32
bits at the source level doesn't imply respective zero extension also
happens at the machine instruction level, and hence the wrong result
could get returned.

Add suitable inline assembly abstraction so that the function can
remain shared between arm32 and arm64. The need to include asm_defns.h
in bitops.h makes it necessary to adjust processor.h though - it is
generally wrong to include public headers without making sure that
integer types are properly defined. (I didn't innvestigate or try
whether the possible alternative of moving the public/arch-arm.h
inclusion down in the file would also work.)

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
xen/include/asm-arm/asm_defns.h
xen/include/asm-arm/bitops.h
xen/include/asm-arm/processor.h